package com.ztmg.water.controller.base;

import com.ztmg.common.util.resultUtils.JsonResult;;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import com.github.pagehelper.PageInfo;


import com.ztmg.water.vo.base.DepositVO;
import com.ztmg.water.dto.base.DepositDTO;
import com.ztmg.water.dto.base.DepositPageDTO;
import com.ztmg.water.service.base.DepositService;


/**
 * 
 * DepositControllerController
 * 
 **/

@Api(description = "押金接口")
@RestController
@RequestMapping(value = "/deposit")
public class DepositController{

	@Resource
	private DepositService depositService;

    @PostMapping("create")
    @ApiOperation("新增")
    public JsonResult create(@RequestBody DepositDTO dto){
        return depositService.create(dto);
    }

    @PostMapping("update")
    @ApiOperation("修改")
    public JsonResult update(@RequestBody DepositDTO dto){
        return depositService.update(dto);
    }

    @GetMapping("detail/{id}")
    @ApiOperation("详情")
    public JsonResult<DepositVO> detail(@PathVariable Integer id){
        return depositService.selectById(id);
    }

    @PostMapping("select")
    @ApiOperation("条件查询")
    public JsonResult<DepositVO> detail(@RequestBody DepositDTO dto){
        return depositService.select(dto);
    }

    @PostMapping("queryPage")
    @ApiOperation("分页查询")
    public JsonResult<PageInfo<DepositVO>> queryPage(@RequestBody DepositPageDTO dto){
        return depositService.selectPage(dto);
    }

    @PostMapping("delete")
    @ApiOperation("条件删除")
    public JsonResult delete(@RequestBody DepositDTO dto){
        return depositService.delete(dto);
    }

    @GetMapping("deleteById/{id}")
    @ApiOperation("删除")
    public JsonResult deleteById(@PathVariable Integer id){
        return depositService.deleteById(id);
    }

}